
package scm.inventoryControl.entity;

import crm.salesOrderProcessing.entity.SalesOrderEntity;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;


@Entity
public class ProductBatchRecordEntity implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;  //batchRecordId
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date manufactureDate;
    @ManyToOne
    private ProductInventoryLevelEntity productInventoryLevel;
    private int quantity;
    private String warehouseLocation;
    private Boolean reserved=false;
//    @ManyToOne
//    private SalesOrderEntity salesOrder;
    
    
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ProductBatchRecordEntity)) {
            return false;
        }
        ProductBatchRecordEntity other = (ProductBatchRecordEntity) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "inventory.entity.ProductBatchRecord[ id=" + id + " ]";
    }

    public Date getManufactureDate() {
        return manufactureDate;
    }

    public void setManufactureDate(Date manufactureDate) {
        this.manufactureDate = manufactureDate;
    }

    public int getQuantity() {
        return quantity;
    }

    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }

    public String getWarehouseLocation() {
        return warehouseLocation;
    }

    public void setWarehouseLocation(String warehouseLocation) {
        this.warehouseLocation = warehouseLocation;
    }

    public ProductInventoryLevelEntity getProductInventoryLevel() {
        return productInventoryLevel;
    }

    public void setProductInventoryLevel(ProductInventoryLevelEntity productInventoryLevel) {
        this.productInventoryLevel = productInventoryLevel;
    }

    public Boolean getReserved() {
        return reserved;
    }

    public void setReserved(Boolean reserved) {
        this.reserved = reserved;
    }

//    public SalesOrderEntity getSalesOrder() {
//        return salesOrder;
//    }
//
//    public void setSalesOrder(SalesOrderEntity salesOrder) {
//        this.salesOrder = salesOrder;
//    }
    
    public String getManufactureDateFormatted()
    {
        return manufactureDate.toString();
    }
    
}
